import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		userInfo: {
			id:'',
			nickName:'',
			realName:'',
			telephone:'',
			cover:'',
			email:'',
			birthday:'',
			signStatus:'',
			sex:'',
			address:'',
			remark:'',
			openId:'',
			userType:'',
			integralCount:'',
			pid:'',
		},
		hasLogin: false,
		loginProvider: "",
		openid: null,
		scene: ""
	},
	mutations: {
		login(state, userInfo) {
			state.hasLogin = true;
			state.userInfo = userInfo;
		},
		logout(state) {
			state.hasLogin = false;
			state.openid = null;
			state.scene = '';
			state.userInfo = {
				id:'',
				nickName:'',
				realName:'',
				telephone:'',
				cover:'',
				email:'',
				birthday:'',
				signStatus:'',
				sex:'',
				address:'',
				remark:'',
				openId:'',
				userType:'',
				integralCount:'',
				pid:'',
			};
		},
		setScene(state, scene) {
			state.scene = scene;
		},
		setOpenid(state, openid) {
			state.openid = openid;
		},
		setProvider(state, provider) {
			state.loginProvider = provider;
		}
		
	}
})

export default store
